//------------------------------------------------------------------------------
#include "CMyVariant.h"
#include <QtDebug>
//------------------------------------------------------------------------------
int CMyVariant::compare(CMyVariant other)
{
	double d1, d2;
	QString s1, s2;
	int ret;
	
	switch(type)
	{
		case QVariant::Double:
		case QVariant::Int: 	
		case QVariant::Bool: 	
		case QVariant::LongLong: 	
		case QVariant::UInt: 	
		case QVariant::ULongLong: 	
			d1=value.toDouble();
			d2=other.getValue().toDouble();
			ret=(int)(d1-d2);
			break;
		default:
			s1=value.toString();
			s2=other.getValue().toString();
			s1.truncate(s2.length());
			ret=s1.compare(s2, Qt::CaseInsensitive);
			break;
	}
	return ret;
}
//------------------------------------------------------------------------------